<style>
#table{
	display: table;
}
.tr{
	display: table-row;
}
.td{
	display: table-cell;
}
a{
	text-decoration: none;
}
.link{
	color: white;
	padding-top: 5px;
	padding-bottom: 5px;
	padding-left:20px;
	padding-right:20px;
	float:right;
}
#bar{
	position:absolute;
	top: 0;
	left: 0;
	right: 0;
	width: 100%;
	min-width: 600px;
	height: 30px;
	background-color: grey;
}
#account{
	color: white;
	text-decoration: none;
}
#welcome{
	float: left;	
	margin-top: 5px;
	padding-bottom: 5px;
}
</style>
<div id="bar">
<?php
	if(session_id() == '') 
		session_start();
	if(isset($_SESSION['link'])){
		$link = $_SERVER['REQUEST_URI'];
		if($_SERVER['HTTP_HOST']== 'localhost' && $link != '/Vote4U/' && $link != '/Vote4U/login.php' && $link != '/Vote4U/exit.php' && $link != '/Vote4U/register.php')
			$_SESSION['link'] = $link;			
	}
	else{
		$_SESSION['link'] = 'account.php';
	}
	if(!isset($_SESSION['uid'])){
?>
		
		<a href="register.php" class="link">Register</a>
		<a href="login.php" class="link">Login</a>
<?php	
	}
	else{
		require("conn.php");
		$usernameResult = mysql_query("select username from account where uid='".$_SESSION['uid']."'");
		$usernameArr = mysql_fetch_assoc($usernameResult);
		mysql_close($connect);
?>
		<span id="welcome">Welcome <a href="account.php" id="account"><?php echo $usernameArr['username']?></a>,</span>			
		<a href="exit.php" class="link">Exit</a>
		<a href="archive.php" class="link">Archive</a>
		
		
<?php
	}
?>
<a href="question_form.php" class="link">Create Questions</a>
<a href="index.php" class="link">Home</a>
</div>
<div style="height:40px"></div>
